public class ProAndCon {
    public static void main(String[] args) {
        MyBlockingqueue queue=new MyBlockingqueue();
        //生产者
        Thread p=new Thread(()->{
            int num=1;
          while (true){
              try {
                  queue.put(""+num);
                  System.out.println("生产："+num);
                  num++;
                  Thread.sleep(1000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }

          }
        });
        Thread c=new Thread(()->{
            while (true){
                try {
                    String ret=queue.tack();
                    Thread.sleep(500);
                    System.out.println("消费："+ret);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        p.start();
        c.start();
    }
}
